package trial.bishi2023;

import java.util.Scanner;

public class ChinaBM {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s =new String("w");
        while (true) {
            int n = sc.nextInt();
//            System.out.println(countWays(n));
            System.out.println("傻逼: " + count(n));
            System.out.println("正确: " + count1(n));
        }

    }

    public static int count(int n) {
        if (n < 3) {
            return n;
        } else if (n == 3) {
            return 4;
        } else {
            return count(n - 2) + count(n - 1) + count(n - 3) - 1;
        }
    }

    public static int count1(int n) {
        int[] dp = new int[n];
        int[] ans = new int[n];
        dp[0] = 1;
        dp[1] = 2;
        for (int i = 2; i < n; i++) {
            dp[i] = dp[i - 2] + dp[i - 1];
        }
        ans[0] = 1;
        ans[1] = 2;
        ans[2] = 4;
        for (int i = 3; i < n; i++) {
            ans[i] = dp[i] + dp[i - 3];
        }
        return ans[n - 1];
//        if (n < 3) {
//            return n;
//        } else if (n == 3) {
//            return 4;
//        } else {
//            return count(n - 2) + count(n - 1) + count(n - 3) - 1;
//        }
    }

    public static int countWays(int n) {
        int[][] dp = new int[n + 1][4];
        dp[0][0] = 1;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= 3; j++) {
                dp[i][1] += dp[i - 1][j];
                if (j == 2 && i >= 2) {
                    dp[i][2] += dp[i - 2][j];
                } else if (j == 3 && i >= 3) {
                    dp[i][3] += dp[i - 3][j];
                }
            }
        }
        return dp[n][1] + dp[n][2] + dp[n][3];
    }
}